
<script setup>
import { ref } from "vue"
import Child from './components/Child.vue'
// 给儿子点数据
const money = ref(100)
const car = ref('小黄车')

// 子传父
const changMoney = (val) => {
  money.value = money.value - val
}
</script>

<template>
  <div>
    <p>我是他亲爹</p>
    <p>爸爸的钱:{{money}}</p>
    <p>爸爸的车: {{car}}</p>
    <!-- 1. 在父组件里给子组件绑定属性 -->
    <Child :money="money" :car="car" @chang-money="changMoney"></Child>
  </div>
</template>

